home *** CD-ROM | disk | FTP | other *** search
/ Aminet 45 / Aminet 45 (2001)(GTI - Schatztruhe)[!][Oct 2001].iso / Aminet / gfx / x11 / x3270_3_2_16.lha / amiga_src / toggles.c < prev    next >
C/C++ Source or Header  |  2008-10-18  |  3KB  |  116 lines

  1. /*
  2.  * Modifications Copyright 1993, 1994, 1995, 1996, 1999, 2000 by Paul Mattes.
  3.  * Original X11 Port Copyright 1990 by Jeff Sparkes.
  4.  *  Permission to use, copy, modify, and distribute this software and its
  5.  *  documentation for any purpose and without fee is hereby granted,
  6.  *  provided that the above copyright notice appear in all copies and that
  7.  *  both that copyright notice and this permission notice appear in
  8.  *  supporting documentation.
  9.  *
  10.  * Copyright 1989 by Georgia Tech Research Corporation, Atlanta, GA 30332.
  11.  *  All Rights Reserved.  GTRC hereby grants public use of this software.
  12.  *  Derivative works based on this software must incorporate this copyright
  13.  *  notice.
  14.  */
  15.  
  16. /*
  17.  *    toggles.c
  18.  *        This module handles toggles.
  19.  */
  20.  
  21. #include "globals.h"
  22. #include "appres.h"
  23.  
  24. #include "ansic.h"
  25. #include "ctlrc.h"
  26. #include "menubarc.h"
  27. #include "screenc.h"
  28. #include "trace_dsc.h"
  29. #include "togglesc.h"
  30.  
  31.  
  32. /*
  33.  * Generic toggle stuff
  34.  */
  35. void
  36. do_toggle(int ix)
  37. {
  38.     struct toggle *t = &appres.toggle[ix];
  39.  
  40.     /*
  41.      * Change the value, call the internal update routine, and reset the
  42.      * menu label(s).
  43.      */
  44.     toggle_toggle(t);
  45.     t->upcall(t, TT_TOGGLE);
  46. #if defined(X3270_MENUS) /*[*/
  47.     menubar_retoggle(t);
  48. #endif /*]*/
  49. }
  50.  
  51. /*
  52.  * Called from system initialization code to handle initial toggle settings.
  53.  */
  54. void
  55. initialize_toggles(void)
  56. {
  57. #if defined(X3270_DISPLAY) || defined(C3270) /*[*/
  58.     appres.toggle[MONOCASE].upcall =         toggle_monocase;
  59. #endif /*]*/
  60. #if defined(X3270_DISPLAY) /*[*/
  61.     appres.toggle[ALT_CURSOR].upcall =       toggle_altCursor;
  62.     appres.toggle[CURSOR_BLINK].upcall =     toggle_cursorBlink;
  63.     appres.toggle[SHOW_TIMING].upcall =      toggle_showTiming;
  64.     appres.toggle[CURSOR_POS].upcall =       toggle_cursorPos;
  65.     appres.toggle[MARGINED_PASTE].upcall =   toggle_nop;
  66.     appres.toggle[RECTANGLE_SELECT].upcall = toggle_nop;
  67.     appres.toggle[SCROLL_BAR].upcall =       toggle_scrollBar;
  68. #endif /*]*/
  69. #if defined(X3270_TRACE) /*[*/
  70.     appres.toggle[DS_TRACE].upcall =         toggle_dsTrace;
  71.     appres.toggle[SCREEN_TRACE].upcall =     toggle_screenTrace;
  72.     appres.toggle[EVENT_TRACE].upcall =      toggle_eventTrace;
  73. #endif /*]*/
  74. #if defined(X3270_ANSI) /*[*/
  75.     appres.toggle[LINE_WRAP].upcall =        toggle_lineWrap;
  76. #endif /*]*/
  77.     appres.toggle[BLANK_FILL].upcall =       toggle_nop;
  78.  
  79. #if defined(X3270_TRACE) /*[*/
  80.     if (toggled(DS_TRACE))
  81.         appres.toggle[DS_TRACE].upcall(&appres.toggle[DS_TRACE],
  82.             TT_INITIAL);
  83.     if (toggled(EVENT_TRACE))
  84.         appres.toggle[EVENT_TRACE].upcall(&appres.toggle[EVENT_TRACE],
  85.             TT_INITIAL);
  86.     if (toggled(SCREEN_TRACE))
  87.         appres.toggle[SCREEN_TRACE].upcall(&appres.toggle[SCREEN_TRACE],
  88.             TT_INITIAL);
  89. #endif /*]*/
  90. }
  91.  
  92. /*
  93.  * Called from system exit code to handle toggles.
  94.  */
  95. void
  96. shutdown_toggles(void)
  97. {
  98. #if defined(X3270_TRACE) /*[*/
  99.     /* Clean up the data stream trace monitor window. */
  100.     if (toggled(DS_TRACE)) {
  101.         appres.toggle[DS_TRACE].value = False;
  102.         toggle_dsTrace(&appres.toggle[DS_TRACE], TT_FINAL);
  103.     }
  104.     if (toggled(EVENT_TRACE)) {
  105.         appres.toggle[EVENT_TRACE].value = False;
  106.         toggle_dsTrace(&appres.toggle[EVENT_TRACE], TT_FINAL);
  107.     }
  108.  
  109.     /* Clean up the screen trace file. */
  110.     if (toggled(SCREEN_TRACE)) {
  111.         appres.toggle[SCREEN_TRACE].value = False;
  112.         toggle_screenTrace(&appres.toggle[SCREEN_TRACE], TT_FINAL);
  113.     }
  114. #endif /*]*/
  115. }
  116.